Optimal. Leaf size=62 \[ \frac{i a^2 \tan (c+d x)}{d}-\frac{2 a^2 \log (\cos (c+d x))}{d}-2 i a^2 x+\frac{(a+i a \tan (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0424361, antiderivative size = 62, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 22, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.136, Rules used = {3527, 3477, 3475} \[ \frac{i a^2 \tan (c+d x)}{d}-\frac{2 a^2 \log (\cos (c+d x))}{d}-2 i a^2 x+\frac{(a+i a \tan (c+d x))^2}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3527
Rule 3477
Rule 3475
Rubi steps
\begin{align*} \int \tan (c+d x) (a+i a \tan (c+d x))^2 \, dx &=\frac{(a+i a \tan (c+d x))^2}{2 d}-i \int (a+i a \tan (c+d x))^2 \, dx\\ &=-2 i a^2 x+\frac{i a^2 \tan (c+d x)}{d}+\frac{(a+i a \tan (c+d x))^2}{2 d}+\left (2 a^2\right ) \int \tan (c+d x) \, dx\\ &=-2 i a^2 x-\frac{2 a^2 \log (\cos (c+d x))}{d}+\frac{i a^2 \tan (c+d x)}{d}+\frac{(a+i a \tan (c+d x))^2}{2 d}\\ \end{align*}
Mathematica [A] time = 0.154691, size = 51, normalized size = 0.82 \[ \frac{a^2 \left (-\tan ^2(c+d x)-4 i \tan ^{-1}(\tan (c+d x))+4 i \tan (c+d x)-4 \log (\cos (c+d x))\right )}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.004, size = 67, normalized size = 1.1 \begin{align*}{\frac{2\,i{a}^{2}\tan \left ( dx+c \right ) }{d}}-{\frac{{a}^{2} \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{2\,d}}+{\frac{{a}^{2}\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) }{d}}-{\frac{2\,i{a}^{2}\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 2.07361, size = 74, normalized size = 1.19 \begin{align*} -\frac{a^{2} \tan \left (d x + c\right )^{2} + 4 i \,{\left (d x + c\right )} a^{2} - 2 \, a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 4 i \, a^{2} \tan \left (d x + c\right )}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.17084, size = 250, normalized size = 4.03 \begin{align*} -\frac{2 \,{\left (3 \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + 2 \, a^{2} +{\left (a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 1.90786, size = 95, normalized size = 1.53 \begin{align*} - \frac{2 a^{2} \log{\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac{- \frac{6 a^{2} e^{- 2 i c} e^{2 i d x}}{d} - \frac{4 a^{2} e^{- 4 i c}}{d}}{e^{4 i d x} + 2 e^{- 2 i c} e^{2 i d x} + e^{- 4 i c}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.32071, size = 157, normalized size = 2.53 \begin{align*} -\frac{2 \,{\left (a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2 \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 3 \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2 \, a^{2}\right )}}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]